package com.iweb.day10;

import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

/**
 * @author WuYongheng
 * @date 2021/11/20
 * @description 测试
 */
public class Test12 {
    public static void main(String[] args) {
        Writer writer = null;
        String path = "d:\\a.txt";
        try {
            //创建对象
            writer = new FileWriter(path);
            // 进行写操作
            String content="好好学习！";
            writer.write(content);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
